<template>
  <div>
    <el-row v-if="showTitle">
      <el-col :span="24">
        <h1>{{ app.VersionTitle }}</h1>
      </el-col>
    </el-row>

    <el-row>
      <el-col class="info-title" :span="12"> 更新时间 </el-col>
      <el-col :span="12"> {{ getDate(app.CreatedAt) }} </el-col>
    </el-row>

    <el-row>
      <el-col class="info-title" :span="12" v-if="app.Platform == 'iOS'">
        version name
      </el-col>
      <el-col class="info-title" :span="12" v-if="app.Platform == 'Android'">
        version
      </el-col>
      <el-col :span="12"> {{ app.Version }} </el-col>
    </el-row>

    <el-row>
      <el-col class="info-title" :span="12" v-if="app.Platform == 'iOS'">
        build
      </el-col>
      <el-col class="info-title" :span="12" v-if="app.Platform == 'Android'">
        version code
      </el-col>
      <el-col :span="12">{{ app.BuildVersion }}</el-col>
    </el-row>

    <el-row>
      <el-col class="info-title" :span="12" v-if="app.Platform == 'iOS'">
        bundle id
      </el-col>
      <el-col class="info-title" :span="12" v-if="app.Platform == 'Android'">
        package name
      </el-col>
      <el-col :span="12">{{ app.PackageName }}</el-col>
      <el-col :span="24"><hr /></el-col>
      <el-col :span="24" class="info-title">更新日志</el-col>
      <el-col :span="24">
        <pre v-if="app.UpdateLog && app.UpdateLog.length > 0">{{
          app.UpdateLog
        }}</pre>
        <el-empty :image-size="80" v-else description="没有更新日志"></el-empty>
      </el-col>
    </el-row>
  </div>
</template>
<script>
import DateFromTimestamp from '@/tools/time-tool.js'
export default {
  props: {
    showTitle: Boolean,
    app: Object
  },
  data () {
    return {

    }
  },
  methods: {

    getDate (timestamp) {
      return DateFromTimestamp(timestamp)
    }
  }
}
</script>

<style lang="scss" scoped>
hr {
  border: none;
  border-bottom: 1px solid;
  border-color: lightgray;
}
</style>
